<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
        <!-- Sidebar user panel -->
        <div class="user-panel">
            <div class="pull-left image">
                <img src="${pageContext.request.contextPath}/img/user2-160x160.jpg" class="img-circle"
                     alt="User Image">
            </div>
            <div class="pull-left info">
                <p>张猿猿</p>
                <a href="#"><i class="fa fa-circle text-success"></i> 在线</a>
            </div>
        </div>

        <!-- sidebar menu: : style can be found in sidebar.less -->
        <ul class="sidebar-menu">
            <li class="header">菜单</li>

            <li id="admin-index"><a href="${pageContext.request.contextPath}/index.jsp"><i
                    class="fa fa-dashboard"></i> <span>首页</span></a></li>

            <!-- 菜单 -->
            <security:authorize access="hasAuthority('ROLE_SYSTEM')">
                <li class="treeview" id="xitong">
                    <a href="#">
                        <i class="fa fa-cogs"></i> <span>系统管理</span>
                        <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                    </a>
                    <ul class="treeview-menu" >
                        <li id="menu_admin">
                            <a href="${pageContext.request.contextPath}/admin/all">
                                <i class="fa fa-circle-o"></i> 用户管理
                            </a>
                        </li>

                        <li id="menu_role">
                            <a href="${pageContext.request.contextPath}/role/all">
                                <i class="fa fa-circle-o"></i> 角色管理
                            </a>
                        </li>

                        <li id="menu_permission">
                            <a href="${pageContext.request.contextPath}/permission/all">
                                <i class="fa fa-circle-o"></i> 权限管理
                            </a>
                        </li>

                        <li id="menu_log">
                            <a href="${pageContext.request.contextPath}/log/all">
                                <i class="fa fa-circle-o"></i> 日志管理
                            </a>
                        </li>

                        <li id="menu_programmer">
                            <a href="${pageContext.request.contextPath}/programmer/all">
                                <i class="fa fa-circle-o"></i> 程序员管理
                            </a>
                        </li>
                    </ul>
                </li>
            </security:authorize>

            <li class="treeview" id="jichu">
                <a href="#">
                    <i class="fa fa-cube"></i> <span>基础数据</span>
                    <span class="pull-right-container">
                        <i class="fa fa-angle-left pull-right"></i>
                    </span>
                </a>
                <ul class="treeview-menu">

                    <security:authorize access="hasAuthority('ROLE_PRODUCT')">
                        <li id="menu_product">
                            <a href="${pageContext.request.contextPath}/product/all">
                                <i class="fa fa-circle-o"></i> 产品管理
                            </a>
                        </li>
                    </security:authorize>

                    <security:authorize access="hasAuthority('ROLE_ORDER')">
                        <li id="menu_order">
                            <a href="${pageContext.request.contextPath}/order/all">
                                <i class="fa fa-circle-o"></i> 订单管理
                            </a>
                        </li>
                    </security:authorize>


                </ul>
            </li>

        </ul>
    </section>
    <!-- /.sidebar -->
</aside>
<script src="${pageContext.request.contextPath}/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script>
    $(function () {
        $(".treeview").click(function () {
            sessionStorage.menu = $(this).attr("id");
        })
        $(".treeview-menu li").click(function () {
            sessionStorage.menu2 = $(this).attr("id")
        })
        $("#"+sessionStorage.menu).addClass("active")
        $("#"+sessionStorage.menu2+" a" ).css("color","white")
    })
</script>
